<?php

class articleMain{
	
	private $db;
	private $introductionList;
	
	function __construct(){
		try {
	
			$this->db = pg_connect("host='".DB_HOST."' dbname='".DB_NAME."' user='".DB_USER."' password='".DB_PASS."'");
		}catch (Exception $e){
			echo $e->getMessage();
		}
	
		$this->setIntroductionList();
	
		return 0;
	}
	
	function setIntroductionList(){
		try {
			$query = "Select url,title,introduction 
				from articles
				order by post_date desc";
			$result = pg_query($this->db,$query);
			$row = pg_fetch_all($result);
	
		}catch (Exception $e){
			echo $e->getMessage();
		}
	
		$this->introductionList=$row;
		//print_r($this->childrenList);
		return 0;
	}
	
	function getintroductionList(){
		return $this->introductionList;
	}
}
?>